package com.wy.servlet.user;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/user/user.do")
public class User extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        Cookie cookie = new Cookie("user", "admin3");
        cookie.setPath(req.getContextPath() + "/admin");
        resp.addCookie(cookie);
        Cookie cookie2 = new Cookie("user", "user3");
        cookie2.setPath(req.getContextPath() + "/user");
        resp.addCookie(cookie2);
    }
}
